obj = klog.o
soobj = klog.so
CFLAGS = -Wall
CFLAGS += -g -DNDEBUG
#CFLAGS += -O2
INCLUDE = -I.
LIB = -L.

all: clean klog.so test

klog.o: klog.h klog.cpp
	g++ $(CFLAGS) klog.cpp $(INCLUDE) $(LIB) -c -o klog.o
$(soobj): $(obj) 
	g++ $(CFLAGS) $(obj) -shared -fPIC -o libklog.so $(INCLUDE) $(LIB) -lpthread
test: $(soobj) test.cpp
	g++ $(CFLAGS) test.cpp -o test $(INCLUDE) $(LIB) -lklog
so: clean klog.so
clean:
	rm -f *.o libklog.so
	rm -f test test.log*
